<?php /*a:2:{s:88:"C:\Users\37547\Desktop\china_and_russia\application\admin\view\article\article_form.html";i:1560934322;s:79:"C:\Users\37547\Desktop\china_and_russia\application\admin\view\public\base.html";i:1560934322;}*/ ?>
<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title><?php echo htmlentities($title); ?></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" type="text/css" href="/static/admin/css/font.css" />
    <link rel="stylesheet" type="text/css" href="/static/admin/css/xadmin.css" />

    <script type="text/javascript" src="/static/admin/js/jquery.min.js"></script>
    <script type="text/javascript" src="/static/admin/lib/layui/layui.js"></script>
    <script type="text/javascript" src="/static/admin/js/global.js"></script>
    <script type="text/javascript" src="/static/admin/js/xadmin.js"></script>
    <script type="text/javascript" src="/static/common/js/common.js"></script>
    <script type="text/javascript" src="/static/admin/js/xcity.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="javascript:void(0);"><?php echo htmlentities($navigate[0]); ?></a>
        <a>
          <cite><?php echo htmlentities($navigate[1]); ?></cite>
        </a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href.split('?')[0]);" title="刷新">
        <i class="layui-icon" style="line-height:30px">&#xe669;</i></a>
</div>

  <style>
      .layui-form-item .layui-input-inline {
          width: 340px;
      }

      #test9 {
          display: none;
      }

      #demo1{
          width: 200px;
      }
  </style>
    <div class="x-body">
        <form class="layui-form">
            <?php if($id): ?>
                <input type="hidden" name="id" value="<?php echo htmlentities($id); ?>">
            <?php endif; ?>
          <div class="layui-form-item">
              <label class="layui-form-label">
                  <span class="x-red">*</span>所属分类
              </label>
              <div class="layui-input-inline">
                  <select name="cat_id">
                      <option value="">请选择分类</option>
                      <?php if(is_array($cate) || $cate instanceof \think\Collection || $cate instanceof \think\Paginator): $i = 0; $__LIST__ = $cate;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                      <option value="<?php echo htmlentities($v['id']); ?>" <?php if($v['id'] == $res['cat_id']): ?>selected<?php endif; ?>><?php echo htmlentities($v['name']); ?></option>
                      <?php endforeach; endif; else: echo "" ;endif; ?>
                  </select>
              </div>
          </div>

          <div class="layui-form-item">
            <label for="title" class="layui-form-label">
                <span class="x-red">*</span>文章标题
            </label>
            <div class="layui-input-inline">
                <input type="text" id="title" name="title" required="" lay-verify="required"
                       autocomplete="off" class="layui-input" value="<?php echo htmlentities($res['title']); ?>">
            </div>
          </div>

            <div class="layui-upload layui-form-item">
                <label class="layui-form-label">
                    <span class="x-red">*</span>新闻缩略图
                </label>
                <button type="button" class="layui-btn layui-btn-normal" id="test8">选择文件</button>
                <button type="button" class="layui-btn" id="test9">开始上传</button>
                <input type="hidden" name="thumbnail" value="<?php echo htmlentities($res['thumbnail']); ?>" id="ad_img">

                <div class="layui-upload-list" style="display: <?php if(!$res): ?>none<?php endif; ?>;">
                    <label class="layui-form-label"></label>
                    <img class="layui-upload-img" id="demo1" src="<?php if($res): ?><?php echo config('imgRoute'); ?><?php echo htmlentities($res['thumbnail']); ?><?php endif; ?>">
                    <p id="demoText"></p>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="keywords" class="layui-form-label">
                    关键词
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="keywords" name="keywords"
                           autocomplete="off" class="layui-input" value="<?php echo htmlentities($res['keywords']); ?>">
                </div>
                <div class="layui-form-mid layui-word-aux">
                    多个关键词，用空格隔开
                </div>
            </div>

            <div class="layui-form-item">
                <label for="link" class="layui-form-label">
                    关键词链接
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="link" name="link"
                           autocomplete="off" class="layui-input" value="<?php echo htmlentities($res['link']); ?>">
                </div>
                <div class="layui-form-mid layui-word-aux">
                    用于每个关键词
                </div>
            </div>

            <div class="layui-form-item layui-form-text">
                <label for="desc" class="layui-form-label"><span class="x-red">*</span>文章内容</label>
                <div class="layui-input-block">
                    <textarea id="desc" name="desc" style="display: none;" lay-verify="content"><?php echo htmlentities($res['desc']); ?></textarea>
                </div>
            </div>

          <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label">
              </label>
              <button  class="layui-btn" lay-filter="edit" lay-submit="" id="L_repass">
                  <?php echo !empty($id) ? '修改'  :  '增加'; ?>
              </button>
          </div>
      </form>
    </div>
    <script>
        $(function (){
            layui.use(['form', 'layedit', 'upload'], function(){
                var upload = layui.upload;
                var form = layui.form;
                // 同步提交编辑器
                var layedit = layui.layedit;
                // 插入图片
                layedit.set({
                    uploadImage: {
                        url: '<?php echo url("article_upload"); ?>'
                        ,type: 'post',
                    }
                });

                var index = layedit.build('desc'); //建立编辑器
                form.verify({
                    content: function(value) {
                        return layedit.sync(index);
                    }
                });

                // 上传图片
                var url = '<?php echo url("article_upload"); ?>';
                uploadImg(upload, url);

                formData('<?php echo url("article/article_form"); ?>', 'edit', function (){
                    parent.location.reload();
                    // 获得frame索引
                    var index = parent.layer.getFrameIndex(window.name);
                    //关闭当前frame
                    parent.layer.close(index);
                }, false);
            });
        })
    </script>
  

<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });

    /*用户-停用*/
    function member_stop(obj,id,url){
        var title = $(obj).attr('title');
        var status = $(obj).data('status');

        layer.confirm('确认要'+ title +'吗？',function(index){
            var token = $("input[name='__token__']",top.window.document).val();
            $.post(url, {'status': status, '__token__': token, 'id': id}, function(res){
                if(res.code == 1){
                    var title = '停用',icon = '&#xe601;',text = '已启用',expr = 6;
                    if(res.data.status == 0){
                        title = '启用';
                        icon = '&#xe62f;';
                        text = '已停用';
                        expr = 5;

                        $(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html(text);
                        $(obj).data('status', '1');
                    }else{
                        $(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html(text);
                        $(obj).data('status', '0');
                    }
                }else{
                    text = res.msg;
                }

                $(obj).attr('title',title)
                $(obj).find('i').html(icon);

                layer.msg(text,{icon: expr,time:1000});

                var token = $("input[name='__token__']",top.window.document).val(res.data.token);
            }, 'json');
        });
    }

    /*用户-删除*/
    function member_del(obj,id, url, fn = false){
        layer.confirm('确认要删除吗？',function(index){
            var token = $("input[name='__token__']",top.window.document).val();
            //发异步删除数据
            $.post(url, {'id': id, '__token__': token},function(res){
                var icon = 2;
                if(res.code == 1){
                    $(obj).parents("tr").remove();
                    icon = 1;
                }
                $("input[name='__token__']",top.window.document).val(res.data.token);
                layer.msg(res.msg, {icon:icon,time:1000}, function(){
                    if(fn)fn();
                });

            },'json');
        });
    }

    function delAll (url) {
        var data = tableCheck.getData();
        var token = $("input[name='__token__']",top.window.document).val();

        layer.confirm('确认要删除吗？'+data,function(index){
            //捉到所有被选中的，发异步进行删除
            $.post(url, {'id': data, '__token__': token},function(res){
                var icon = 2;
                if(res.code == 1){
                    $(".layui-form-checked").not('.header').parents('tr').remove();
                    icon = 1;
                }
                $("input[name='__token__']",top.window.document).val(res.data.token);
                layer.msg(res.msg, {icon:icon,time:1000});
            },'json');
        });
    }

    // 跳转地址
    function load_url(url){
        window.location.href = url;
    }

</script>
<script>var _hmt = _hmt || []; (function() {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();</script>
</body>

</html>